package com.meal.test.config;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import java.util.Arrays;
import java.util.List;
import java.util.Set;

/**
 * @Title: StartRunner
 * @Description: 启动执行
 * @Author yangzhanghui
 * @Date 2020/5/720:52
 * @Version v1.0
 */
@Slf4j
@Component
@Order(100)
public class AppliRunner implements ApplicationRunner {


    @Override
    public void run(ApplicationArguments args) throws Exception {
        List<String> list = args.getNonOptionArgs();
        System.out.println(list);
        Set<String> optionNames = args.getOptionNames();
        optionNames.forEach(name -> System.out.println(name + "===" + args.getOptionValues(name)));
        String[] sourceArgs = args.getSourceArgs();
        System.out.println(Arrays.toString(sourceArgs));
    }
}
